/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.isn.hospitalizacion.entity;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

import com.isn.atencionemergencia.entity.OrdenDeAtencionDeEmergencia;
import com.isn.logueo.entity.Usuario;

/**
 *
 * @author pool
 */
@Entity
@Table(name = "orden_hospitalizacion")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "OrdenHospitalizacion.findAll", query = "SELECT o FROM OrdenHospitalizacion o"),
    @NamedQuery(name = "OrdenHospitalizacion.findByCodOrdHosp", query = "SELECT o FROM OrdenHospitalizacion o WHERE o.codOrdHosp = :codOrdHosp"),
    @NamedQuery(name = "OrdenHospitalizacion.findByFecOrdHosp", query = "SELECT o FROM OrdenHospitalizacion o WHERE o.fecOrdHosp = :fecOrdHosp"),
    @NamedQuery(name = "OrdenHospitalizacion.findByDescDiag", query = "SELECT o FROM OrdenHospitalizacion o WHERE o.descDiag = :descDiag"),
    @NamedQuery(name = "OrdenHospitalizacion.findByTipOpe", query = "SELECT o FROM OrdenHospitalizacion o WHERE o.tipOpe = :tipOpe")})
public class OrdenHospitalizacion implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "Cod_Ord_Hosp", columnDefinition="CHAR(5) unsigned")
    private String codOrdHosp;
    @Column(name = "Fec_Ord_Hosp")
    @Temporal(TemporalType.DATE)
    private Date fecOrdHosp;
    @Column(name = "Desc_Diag")
    private String descDiag;
    @Basic(optional = false)
    @Column(name = "tip_ope")
    private String tipOpe;
    @JoinColumn(name = "Usuario", referencedColumnName = "Usuario")
    @ManyToOne(optional = false)
    private Usuario usuario;
    @JoinColumn(name = "Cod_Tipo_Diag", referencedColumnName = "Cod_Tipo_Diag")
    @ManyToOne(optional = false)
    private TipoDiagnostico codTipoDiag;
    @JoinColumn(name = "Cod_Urge", referencedColumnName = "Cod_Urge")
    @ManyToOne(optional = false)
    private Urgencia codUrge;
    @JoinColumn(name = "num_oae", referencedColumnName = "Num_Oae")
    @ManyToOne(optional = false)
    private OrdenDeAtencionDeEmergencia numOae;

    public OrdenHospitalizacion() {
    }

    public OrdenHospitalizacion(String codOrdHosp) {
        this.codOrdHosp = codOrdHosp;
    }

    public OrdenHospitalizacion(String codOrdHosp, String tipOpe) {
        this.codOrdHosp = codOrdHosp;
        this.tipOpe = tipOpe;
    }

    public String getCodOrdHosp() {
        return codOrdHosp;
    }

    public void setCodOrdHosp(String codOrdHosp) {
        this.codOrdHosp = codOrdHosp;
    }

    public Date getFecOrdHosp() {
        return fecOrdHosp;
    }

    public void setFecOrdHosp(Date fecOrdHosp) {
        this.fecOrdHosp = fecOrdHosp;
    }

    public String getDescDiag() {
        return descDiag;
    }

    public void setDescDiag(String descDiag) {
        this.descDiag = descDiag;
    }

    public String getTipOpe() {
        return tipOpe;
    }

    public void setTipOpe(String tipOpe) {
        this.tipOpe = tipOpe;
    }

    public Usuario getUsuario() {
        return usuario;
    }

    public void setUsuario(Usuario usuario) {
        this.usuario = usuario;
    }

    public TipoDiagnostico getCodTipoDiag() {
        return codTipoDiag;
    }

    public void setCodTipoDiag(TipoDiagnostico codTipoDiag) {
        this.codTipoDiag = codTipoDiag;
    }

    public Urgencia getCodUrge() {
        return codUrge;
    }

    public void setCodUrge(Urgencia codUrge) {
        this.codUrge = codUrge;
    }

    public OrdenDeAtencionDeEmergencia getNumOae() {
        return numOae;
    }

    public void setNumOae(OrdenDeAtencionDeEmergencia numOae) {
        this.numOae = numOae;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (codOrdHosp != null ? codOrdHosp.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof OrdenHospitalizacion)) {
            return false;
        }
        OrdenHospitalizacion other = (OrdenHospitalizacion) object;
        if ((this.codOrdHosp == null && other.codOrdHosp != null) || (this.codOrdHosp != null && !this.codOrdHosp.equals(other.codOrdHosp))) {
            return false;
        }
        return true;
    }
    
}
